package org.springblade.modules.admin.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description 合同状态枚举
 * @Author ysq
 * @Date 2021/12/7
 **/
@Getter
@AllArgsConstructor
public enum ContractStatusEnum {

	NO_START(1, "未生效"),

	WORKED(2, "已生效"),

	EXPIRY(3, "已到期"),

	STOP(4, "已终止");

	final Integer status;

	final String name;

	/**
	 * 根据状态获取name
	 */
	public static String getName(Integer status) {
		for (ContractStatusEnum contractStatusEnum : ContractStatusEnum.values()) {
			if (contractStatusEnum.getStatus().equals(status)) {
				return contractStatusEnum.getName();
			}
		}
		return null;
	}
}
